import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('GameLaunch')
export class GameLanch extends Component {
    onLoad() {
        // 初始化框架模块: 网络模型，资源管理模块，协议模块，...
        // end 
    }

    start() {
        const propName = this._getPropName("btnStart");
        console.log(propName);
    }
        
    
    // 转换节点名为属性名
    private _getPropName(nodeName: string): string {
        // 处理 btnStart → startBtn 的转换
        const prefixMatch = nodeName.match(/^([a-z]+)([A-Z].*)$/);
        if (prefixMatch) {
            const [_, prefix, rest] = prefixMatch;
            return rest.charAt(0).toLowerCase() + rest.slice(1) + prefix.charAt(0).toUpperCase() + prefix.slice(1);
        }
        return nodeName;
    }

}
